﻿using NPOI.HSSF.UserModel;
using System;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Windows;

namespace ExeclReader
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();

         

        public MainWindow()
        {
            InitializeComponent();

            dialog.SelectedPath = System.AppDomain.CurrentDomain.BaseDirectory;
        }

        private void OpenFileBtn_Click(object sender, RoutedEventArgs e)
        {
            dialog.RootFolder = Environment.SpecialFolder.Desktop;
            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            DirTextBox.Text = dialog.SelectedPath;
        }

        private void LoadFilesBtn_Click(object sender, RoutedEventArgs e)
        {
            string fileName = @"D:\Projects\Alimentador\ExeclReader\bin\Release\Alimentos\Acucar\ficha.xls"; //DirTextBox.Text + "\\ficha.xls";



            //try
            //{
            //    // Opening the Excel template... 
            //    FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            //    HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true);
            //    HSSFSheet sheet = templateWorkbook.GetSheet("Ficha");
            //    HSSFRow dataRow = sheet.GetRow(3);

            //    System.Console.WriteLine("Data: " + dataRow.GetCell(1).ToString());
            //}
            //catch(Exception ex)
            //{
            //    System.Console.Write("Exception: " + ex.Message);
            //}
        }
    }
}
